package com.gaussian.property.app.service;

import com.gaussian.property.module.biz.entity.AppUser;
import com.gaussian.property.module.biz.service.IAppUserService;
import com.songqi.common.security.model.LoginUser;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashSet;

/**
 * @description:
 * @author: songqi(13776346982)
 * @date: 2023/2/25 19:57
 */
@Service(value = "userDetailsServiceImplByWechat")
public class UserDetailsServiceImplByWechat implements UserDetailsService {

    @Resource
    private IAppUserService iAppUserService;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        AppUser appUser = iAppUserService.getById(username);
        return new LoginUser(appUser, new HashSet<>());
    }

}
